﻿using System.Web.Mvc;
using System;

namespace ProgrammingSchool.Infrastructure.Filters.Exceptions
{
    public class ExeptionHandlingAttribute : HandleErrorAttribute
    {
        public override void OnException(ExceptionContext filterContext)
        {
            if (filterContext.ExceptionHandled)
            {
                // don't log exceptions which were handled.
                return;
            }

            LogException(filterContext.Exception);
        }

        private static void LogException(Exception exception)
        {
            //TODO: use log4net to handle exception
        }
    }
}